<template>
  <div class="app-container">
    <div class="filter-container" align="left">

    </div>

    <el-table :data="userList" style="width: 100%" align="center">
      <el-table-column label="序号" align="center">
        <template slot-scope="scope">
          <span>{{ scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column label="姓名" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.userName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="性别" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.userSex == 0 ? '男' : '女' }}</span>
        </template>
      </el-table-column>
      <el-table-column label="手机号" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.userPhone }}</span>
        </template>
      </el-table-column>
      <el-table-column label="简介" align="center" width="200">
        <template slot-scope="scope">
          <span>{{ scope.row.userIntro }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" width="180" align="center">
        <template slot-scope="scope">
          <i class="el-icon-time"></i>
          <span>{{ scope.row.userTime }}</span>
        </template>
      </el-table-column>
      <el-table-column label="状态" align="center">
        <template slot-scope="scope">
          <el-switch v-model="scope.row.userStatus" active-color="#13ce66">
          </el-switch>
        </template>
      </el-table-column>
      <!-- <el-table-column label="操作" align="center" width="180">
        <template slot-scope="scope">
          <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column> -->
    </el-table>
  </div>
</template>

<script>
import { selectAll, del, searchByName } from '../../api/usermanage/user.js'
export default {
  data() {
    return {
      userList: [
        {
          userId: 1,
          userImg: 'https://img2.baidu.com/it/u=2080244369,3435160753&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
          userName: '张张',
          userSex: 0,
          userDesc: '这是个人简介',
          userPhone: 1234948924,
          userDate: '2021-21-22',
          userStatus: true,
        }
      ],
      search: ''
    }
  },
  methods: {

    // 查询所有
    async selectAll_() {
      let res = await selectAll();
      console.log(res)
      this.userList = res.data;
    },
    // 根据种类名查询
    async searchByName_(params) {
      let res = await searchByName(params);
      this.userList = res.data
    },
  },
  created() {
    this.selectAll_()
  },
}
</script>